﻿using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Security.Principal;
using System.Text;

namespace PrjAssessModels.BaseModels
{
    public class User : BaseEntity, IPrincipal, IIdentity
    {
        [Required]
        [Display(Name = "用户名")]
        public String UserCode { get; set; }
        [Required]
        [Display(Name = "密码")]
        public String UserPwd { get; set; }
        [Required]
        [Display(Name = "姓名")]
        public String UserName { get; set; }

        [Required]
        [Display(Name = "用户类型")]
        public int UserType { get; set; }
        public String Name { get { return UserName; } }
        public string AuthenticationType
        {
            get
            {
                return "Froms";
            }
        }
        public bool IsAuthenticated
        {
            get
            {
                return true;
            }
        }

        public IIdentity Identity { get { return this; } }
        public bool IsInRole(string role) { return false; }
    }

    public class LoginModel
    {
        [Required]
        [Display(Name = "用户名")]
        public String UserCode { get; set; }
        [Required]
        [Display(Name = "密码")]
        public String UserPwd { get; set; }
    }
}
